
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%
String id=request.getParameter("additem");
String group="group";
String project="project";
String task="task";
String group_member="group_member";
String employee="employee";
String notice="notice";
String passwd=null;
%>

           
       
<% if(id.equalsIgnoreCase(group)){%>

<div id="right">
    <div class="maincol">
        
        <form action="insert_group.jsp" method="post" name="add_employee" target="_blank">
            <table width="600px">
               
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Name</th>
                    <th width="100px" align="left"><input name="group_name" type="text" value="group name" size="50" maxlength="25" /></th>
                </tr>
                
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Project</th>
                    <th width="100px">
                        <select name="project">
                        <%  //connect to database and set the emp_id to the session
        String query="select distinct(name) from project";
        Connection db_conn = null;
        Statement statement = null;
        PreparedStatement pstmt;
        ResultSet rs;
        try{
            Class.forName("com.mysql.jdbc.Driver");
            String url= "jdbc:mysql://localhost:3306/db";
            db_conn = DriverManager.getConnection( url,"root", "root" );
            statement = db_conn.createStatement();
            //rs=statement.executeUpdate(query);
            rs=statement.executeQuery(query); 
                                   while (rs.next()) { // parse the results
                passwd=rs.getString("name");
                out.println("<option value='"+passwd+"'>"+passwd+"</option>");} 
                out.println("</select>");
                db_conn.close();
        } catch(SQLException e){
            e.printStackTrace();
            out.println("sql not found");
            out.println(e);
        } catch(ClassNotFoundException e){
            e.printStackTrace();
            out.println(e);
        }
        %>
                    </th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px"></th>
                    <th width="100px"><input type="submit" value="OK" /></th>
                </tr>           
            </table>  
        </form>          
    </div>
</div>
  

<%  }else if(id.equalsIgnoreCase(group_member)){%>
<div id="right">
    <div class="maincol">
        
        <form action="insert_group_member.jsp" method="post"  target="_blank">
            <table width="600px">
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Group name</th>
                    <th width="100px">
                        
                     <select name="group_name">   
                        <%  //connect to database and set the emp_id to the session
        String query="select distinct(group1.group_name) from group1";
        Connection db_conn = null;
        Statement statement = null;
        PreparedStatement pstmt;
        ResultSet rs;
        try{
            Class.forName("com.mysql.jdbc.Driver");
            String url= "jdbc:mysql://localhost:3306/db";
            db_conn = DriverManager.getConnection( url,"root", "root" );
            statement = db_conn.createStatement();
            //rs=statement.executeUpdate(query);
            rs=statement.executeQuery(query); 
                                   while (rs.next()) { // parse the results
                passwd=rs.getString("group_name");
                out.println("<option value='"+passwd+"'>"+passwd+"</option>");} 
                out.println("</select>");
                db_conn.close();
        } catch(SQLException e){
            e.printStackTrace();
            out.println("sql not found");
            out.println(e);
        } catch(ClassNotFoundException e){
            e.printStackTrace();
            out.println(e);
        }
        %>    
                        
                        
                        
                        
                    </th>
                </tr>
                
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    
                    <th width="100px">Employee name</th>
                    <th width="100px">
                        
                         <select name="a">   
                        <%  //connect to database and set the emp_id to the session
        String query1="select distinct(employee.name) from employee";
        Connection db_conn1 = null;
        Statement statement1 = null;
        PreparedStatement pstmt1;
        ResultSet rs1;
        try{
            Class.forName("com.mysql.jdbc.Driver");
            String url= "jdbc:mysql://localhost:3306/db";
            db_conn1 = DriverManager.getConnection( url,"root", "root" );
            statement1 = db_conn1.createStatement();
            //rs=statement.executeUpdate(query);
            rs1=statement1.executeQuery(query1); 
                                   while (rs1.next()) { // parse the results
                passwd=rs1.getString("name");
                out.println("<option value='"+passwd+"'>"+passwd+"</option>");} 
                out.println("</select>");
                db_conn1.close();
        } catch(SQLException e){
            e.printStackTrace();
            out.println("sql not found");
            out.println(e);
        } catch(ClassNotFoundException e){
            e.printStackTrace();
            out.println(e);
        }
        %>    
                        
                        
                        
                    </th>
                </tr>
             
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px"></th>
                    <th width="100px"><input type="submit" value="OK" /></th>
                </tr>           
            </table>  
        </form>          
    </div>
</div>
<%  }else if(id.equalsIgnoreCase(notice)){%>
<div id="right">
    <div class="maincol">
        
        <form action="insert_notice.jsp" method="get" name="add_project" target="_blank">
            <table width="600px">
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Employee name</th>
                    <th width="100px">
                        
                        
                        
                      <select name="employee_name">   
                        <%  //connect to database and set the emp_id to the session
        String query1="select distinct(employee.name) from employee";
        Connection db_conn1 = null;
        Statement statement1 = null;
        PreparedStatement pstmt1;
        ResultSet rs1;
        try{
            Class.forName("com.mysql.jdbc.Driver");
            String url= "jdbc:mysql://localhost:3306/db";
            db_conn1 = DriverManager.getConnection( url,"root", "root" );
            statement1 = db_conn1.createStatement();
            //rs=statement.executeUpdate(query);
            rs1=statement1.executeQuery(query1); 
                                   while (rs1.next()) { // parse the results
                passwd=rs1.getString("name");
                out.println("<option value='"+passwd+"'>"+passwd+"</option>");} 
                out.println("</select>");
                db_conn1.close();
        } catch(SQLException e){
            e.printStackTrace();
            out.println("sql not found");
            out.println(e);
        } catch(ClassNotFoundException e){
            e.printStackTrace();
            out.println(e);
        }
        %>         
                          
                        
                        
                        
                        
                        
                    </th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Notice</th>
                    <th width="100px"><textarea name="notice" rows="5"></textarea></th>
                </tr>
               
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px"></th>
                    <th width="100px"><input type="submit" value="OK" /></th>
                </tr>           
            </table>  
        </form>          
    </div>
</div>
<%  }else if(id.equalsIgnoreCase(project)){%>
<div id="right">
    <div class="maincol">
        
        <form action="insert_project.jsp" method="get" name="add_project" target="_blank">
            <table width="600px">
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Name</th>
                    <th width="100px"><input name="project_name" type="text" value="" size="50" maxlength="25" /></th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Client</th>
                    <th width="100px"><input name="client_name" type="text" value="" size="50" maxlength="25" /></th>
                </tr>            
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Start Date</th>
                    <th width="100px"><input name="start_date" type="text" value="yyyy-mm-dd" size="50" maxlength="25" /></th>
                </tr>            
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">End Date</th>
                    <th width="100px"><input name="end_date" type="text" value="yyyy-mm-dd" size="50" maxlength="25" /></th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Priority</th>
                    <th width="100px">
                        <select name="priority">
                            <option value="Urgent">Urgent</option>
                            <option value="Critical">Critical</option>
                            <option value="High">High</option>
                            <option value="Medium">Medium</option>
                            <option value="Low">Low</option>
                            
                        </select>
                    </th>
                </tr>
                
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Type</th>
                    <th width="100px">
                        <select name="type">
                            <option value="Urgent">Modification</option>
                            <option value="Critical">Defect</option>
                            <option value="High">Issue</option>
                            <option value="Medium">Maintenance</option>
                            <option value="Low">Addition</option>
                            
                        </select>
                    </th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Status</th>
                    <th width="100px">
                        <select name="status">
                            <option value="todo">To do</option>
                            <option value="Running">Running</option>
                            <option value="totest">To Test</option>
                            
                            
                        </select>
                    </th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px"></th>
                    <th width="100px"><input type="submit" value="OK" /></th>
                </tr>           
            </table>  
        </form>          
    </div>
</div>
<%  }else if(id.equalsIgnoreCase(task)){%>
<div id="right">
    <div class="maincol">
        
        <form action="insert_task.jsp" method="get" name="add_task" target="_blank">
            <table width="600px">
                
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Task Name</th>
                    <th width="100px"><input name="task_name" type="text" value="" size="50" maxlength="25" /></th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Related Project</th>
                    <th width="100px">
                        
                      
                     <select name="project">
                        <%  //connect to database and set the emp_id to the session
        String query="select distinct(name) from project";
        Connection db_conn = null;
        Statement statement = null;
        PreparedStatement pstmt;
        ResultSet rs;
        try{
            Class.forName("com.mysql.jdbc.Driver");
            String url= "jdbc:mysql://localhost:3306/db";
            db_conn = DriverManager.getConnection( url,"root", "root" );
            statement = db_conn.createStatement();
            //rs=statement.executeUpdate(query);
            rs=statement.executeQuery(query); 
                                   while (rs.next()) { // parse the results
                passwd=rs.getString("name");
                out.println("<option value='"+passwd+"'>"+passwd+"</option>");} 
                out.println("</select>");
                db_conn.close();
        } catch(SQLException e){
            e.printStackTrace();
            out.println("sql not found");
            out.println(e);
        } catch(ClassNotFoundException e){
            e.printStackTrace();
            out.println(e);
        }
        %>   
                        
                    
                        
                    </th>
                </tr>            
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Status</th>
                    <th width="100px">
                        <select name="status">
                            <option value="todo">To do</option>
                            <option value="Running">Running</option>
                            <option value="totest">To Test</option>
                            
                            
                        </select>
                    </th>
                </tr>            
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">type</th>
                    <th width="100px">
                        <select name="type">
                            <option value="Urgent">Modification</option>
                            <option value="Critical">Defect</option>
                            <option value="High">Issue</option>
                            <option value="Medium">Maintenance</option>
                            <option value="Low">Addition</option>
                            
                        </select>
                    </th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Start Date</th>
                    <th width="100px"><input name="s_date" type="text" value="yyyy-mm-dd" size="50" maxlength="25" /></th>
                </tr>
                
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Estimated Date</th>
                    <th width="100px"><input name="e_date" type="text" value="yyyy-mm-dd" size="50" maxlength="25" /></th>
                </tr>
               <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Summary</th>
                    <th width="100px"><input name="summary" type="text" value="" size="50" maxlength="250" /></th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px"></th>
                    <th width="100px"><input type="submit" value="OK" /></th>
                </tr>           
            </table>  
        </form>          
    </div>
</div>

<%  }else if(id.equalsIgnoreCase(employee)){%>
<div id="right">
    <div class="maincol">
        
        <form action="insert_employee.jsp" method="get" name="add_employee" target="_blank">
            <table width="600px">
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Name</th>
                    <th width="100px"><input name="employee_name" type="text" value="employee name" size="50" maxlength="25" /></th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">phone</th>
                    <th width="100px"><input name="phone" type="text" value="phone" size="50" maxlength="25" /></th>
                </tr>            
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Qualification</th>
                    <th width="100px"><input name="qualification" type="text" value="qualification" size="50" maxlength="25" /></th>
                </tr>            
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Gender</th>
                    <th width="100px"><input name="gender" type="text" value="gender" size="50" maxlength="25" /></th>
                </tr>
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px">Notice</th>
                    <th width="100px"><input name="notice" type="text" value="notice" size="50" maxlength="25" /></th>
                </tr>
                
                <tr bgcolor="#EEEEEE" align="center" height="20px">
                    <th width="100px"></th>
                    <th width="100px"><input type="submit" value="OK" /></th>
                </tr>           
            </table>  
        </form>          
    </div>
</div>



<%  }else{%>
<%} %>
